#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long LL;
LL Fac[]={2,3,5,7};
int main() {
    LL n;
    scanf("%lld", &n);
    LL cnt=0;
    for (int i=1; i<16; ++i) {
        LL f=1, c=0;
        for (int j=0; j<4; ++j) {
            if (i&(1<<j)) {
                ++c;
                f*=Fac[j];
            }
        }
        if (c%2) cnt+=n/f;
        else cnt-=n/f;
    }
    printf("%lld\n", n-cnt);
    return 0;
}
